<?php 
$params = Yii::app()->controller->getActionParams();
if (!empty($params)) {
    foreach($params as $key => $value) {
        if ($key == 'lang')
            $langParam = $value;
    }
}
?>

<?php
$this->pageTitle=Yii::app()->name;
foreach($model as $m)
{  // loop to get the data (this is different from the complex way)

    ?>
<div class="product_box">
    <a href="<?php echo Yii::app()->request->baseUrl;?>/index.php?r=site/Productdetail&id=<?php echo $m->IDSP;?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>">
        <img src="<?php echo Yii::app()->request->baseUrl; echo"/images/products/";?><?php echo $m->HINHANH ?> "/>
    </a>
    <h3><?php echo $m->TENSP; ?></h3>
    <p class="product_price"><?php echo number_format($m->GIATIEN,0,".",","); ?></p>
    <a href="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=cart/AddCart&maSp=<?php echo $m->IDSP?>&slg=1<?php if (!empty($langParam)) echo "&lang=".$langParam; ?>" class="add_to_card"><?php echo Yii::t('translation', 'AddToCart') ?></a>
    <a href="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=site/Productdetail&id=<?php echo $m->IDSP?><?php if (!empty($langParam)) echo "&lang=".$langParam; ?>" class="detail"><?php echo Yii::t('translation', 'Detail') ?></a>
</div>
<?php
}
//endline endline cái đi
echo '<div style="clear: both;"></div>';
echo '<div style="text-align: center;">';
// display pagination
$this->widget('CLinkPager', array(
    'pages' => $pages,
));
echo '</div>';
?>







